<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <input type="text" class="input-check" /><button class="btn-check">检查</button>

    <script>
        window.onload = function() {
            var inputCheck = document.querySelector(".input-check");
            var btnCheck = document.querySelector(".btn-check");

            btnCheck.addEventListener("click", function() {
                var value = inputCheck.value;

                var arr = value.split(" ");
                var temp = "";
                for (var i = 0; i < arr.length; i++) {
                    temp = temp + arr[i];
                }
                console.log(temp);
            })
        }
    </script>
</body>

</html>